/* GUI CONVERTED from regetwo.p (converter v1.76) Wed Aug 21 04:17:10 2002 */
/* regetwo.p - REPETITIVE - FIND CUMULATIVE WORK ORDER FOR A GIVEN CRITERIA   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.9 $                                                           */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3          LAST MODIFIED: 10/31/94   BY: WUG *GN77*            */
/* REVISION: 9.0          LAST MODIFIED: 04/16/99   BY: *J2DG* Reetu Kapoor   */
/* REVISION: 9.1          LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown     */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* Revision: 1.8     BY: Jean Miller           DATE: 04/16/02  ECO: *P05H*    */
/* $Revision: 1.9 $    BY: Kirti Desai           DATE: 08/19/02  ECO: *N1QR*  */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

/* GLOBAL SHARED VARIABLES DEFINITION */
{mfdeclre.i}

/* SUBPROGRAM TO FIND A CUM WORKORDER                                         */

define input  parameter site     as character no-undo.
define input  parameter part     as character no-undo.
define input  parameter eff_date as date  no-undo.
define input  parameter line     as character no-undo.
define input  parameter routing  as character no-undo.
define input  parameter bom_code as character no-undo.
define output parameter wolot    as character no-undo.

wolot = ?.

for first wo_mstr
   fields (wo_bom_code wo_due_date wo_line wo_lot wo_nbr wo_part
           wo_rel_date wo_routing wo_site wo_type)
   where wo_type       = "C"
     and wo_part       = part
     and wo_site       = site
     and wo_due_date  >= eff_date
     and (wo_rel_date <= eff_date
      or wo_rel_date   = ?)
     and wo_line       = line
     and wo_routing    = routing
     and wo_bom_code   = bom_code
     and wo_nbr        = ""
   no-lock
   use-index wo_type_part:

   wolot = wo_lot.

end. /* FOR FIRST wo_mstr */

if wolot = ?
then
   for first wo_mstr
      fields (wo_bom_code wo_due_date wo_line wo_lot wo_nbr wo_part
              wo_rel_date wo_routing wo_site wo_type)
      where wo_type       = "C"
        and wo_part       = part
        and wo_site       = site
        and wo_due_date   = ?
        and (wo_rel_date <= eff_date
         or wo_rel_date   = ?)
        and wo_line       = line
        and wo_routing    = routing
        and wo_bom_code   = bom_code
        and wo_nbr        = ""
      no-lock
      use-index wo_type_part:

      wolot = wo_lot.

   end. /* FOR FIRST wo_mstr */
